import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { CompetitionOrderVO, CompetitionOrderForm, CompetitionOrderQuery } from '@/api/system/competitionOrder/types';

/**
 * 查询竞赛订单列表
 * @param query
 * @returns {*}
 */

export const listCompetitionOrder = (query?: CompetitionOrderQuery): AxiosPromise<CompetitionOrderVO[]> => {
  return request({
    url: '/system/competitionOrder/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询竞赛订单详细
 * @param id
 */
export const getCompetitionOrder = (id: string | number): AxiosPromise<CompetitionOrderVO> => {
  return request({
    url: '/system/competitionOrder/' + id,
    method: 'get'
  });
};

/**
 * 新增竞赛订单
 * @param data
 */
export const addCompetitionOrder = (data: CompetitionOrderForm) => {
  return request({
    url: '/system/competitionOrder',
    method: 'post',
    data: data
  });
};

/**
 * 修改竞赛订单
 * @param data
 */
export const updateCompetitionOrder = (data: CompetitionOrderForm) => {
  return request({
    url: '/system/competitionOrder',
    method: 'put',
    data: data
  });
};

/**
 * 删除竞赛订单
 * @param id
 */
export const delCompetitionOrder = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/competitionOrder/' + id,
    method: 'delete'
  });
};
